package de.fhhannover.inform.hnefatafl.gui;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

public class AttackerOption extends JPanel{
	
	private static final long serialVersionUID = 1L;
	
	public JRadioButton attackerOption1,
						attackerOption2;
	public ButtonGroup  attacker;
	public JLabel       label,
						strategyLabel;
	public JTextField   nameField;
	public JButton		strategyPopup;
	
	public AttackerOption(){
		this.setLayout(new GridLayout(3, 2));
		this.setBorder(new TitledBorder(new EtchedBorder(), "Angreifer"));
		
		attacker = new ButtonGroup();
		
		attackerOption1 = new JRadioButton("Spieler  ");
		attacker.add(attackerOption1);
		this.add(attackerOption1);
		attackerOption1.setSelected(true);
		
		attackerOption2 = new JRadioButton("KI");
		attacker.add(attackerOption2);
		this.add(attackerOption2);
		
		label = new JLabel(" :Name",SwingConstants.LEFT);
		nameField = new JTextField("Angreifer");
		label.setLabelFor(nameField);
			
		this.add(nameField);
		this.add(label);
		
		strategyPopup = new JButton("<<<");
		this.add(strategyPopup);
		
		strategyPopup.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				GUIController.getInstance().showAttackerStrategy();		
			}});
		
		strategyLabel = new JLabel(" :Strategy",SwingConstants.LEFT);
		this.add(strategyLabel);
		
	}

}

